////////////////////////////////////////////////////////////////////////////////
///////// Product Market Competition and Convertible Debt Financing ////////////
///////// Cheng Lei, Evgeny Lyandres, Chris Veld, Ying Xia /////////////////////
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
* Date: April 27, 2024
* This do file contains code generating results for Table 5
* Please define the path for datasets and the path for storing results before running the following program. 
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
* Use the sample for stacked DiD approach
* [Stacked_DiD_Sample]

use "Path\Stacked_DiD_Sample.dta", clear

* Control variable
global control size lage cash i.divd i.rep cf tangib capex mb rda Vol_12 
* Cluster
global cluster event#gvkey1
* fixed effects
global fe event#gvkey1 event#cyear


********************************************************************************
* Table 5 Large Tariff Reductions, Convertible Debt Financin, annd Firm Performance
********************************************************************************
* Panel A
global x1 i.treat##i.post

* Model 1
reghdfe convo $x1 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a1

* Model 2
reghdfe covdum $x1 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a2

* Model 3
reghdfe fconv1 $x1 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a3

* Model 4
reghdfe fconv2 $x1 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a4

* Panel B
* Parallel Trends Assumption
global x2 i.treat##i.time2

* Model 1
reghdfe convo $x2 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a5

* Model 2
reghdfe covdum $x2 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a6

* Model 3
reghdfe fconv1 $x2 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a7

* Model 4
reghdfe fconv2 $x2 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a8

* Panel C
* Post-Reduction User
global x3 i.treat##i.post##i.gpostuserp

* Model 1
reghdfe fsgr $x3 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a9

* Model 3
reghdfe fadjmdsgr_sic3 $x3 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a10

* Post-Reduction Initiator
global x4 i.treat##i.post##i.postinip

* Model 2
reghdfe fsgr $x4 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a11

* Model 4
reghdfe fadjmdsgr_sic3 $x4 $control , absorb($fe)  cluster($cluster) keepsingleton
estimates store a12


esttab  a1 a2 a3 a4 a5 a6 a7 a8 a9 a11 a10 a12 using "Path\Table_5.csv", b(3) t(2) scalars("ll Log lik.") pr2(4) ar2(4) starlevels(* 0.10 ** 0.05 *** 0.01)  replace nogaps

////////////////////////////////////////////////////////////////////////////////
* The above codes generate the result, and the format of table is finalised in Excel. 
* cyear = fyear + 1, which was used to merge tariff reduction event dataset and firm-year sample. It does not affect the estimation. 
* Keepsingleton allows the estimation to be conducted based on the full sample. The results are unchanged if running without this requirement. 
////////////////////////////////////////////////////////////////////////////////



